package com.zhentao.api.schedule;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.schedule.dto.TaskDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


@FeignClient("leadnews-schedule")
public interface ScheduleClientApi {

    /**
     * 添加任务
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/task/add")
    ResponseResult addTask(@RequestBody TaskDto dto);

    /**
     * 取消任务
     *
     * @param taskId
     * @return
     */
    @GetMapping("/api/v1/task/{taskId}")
    public ResponseResult canceTask(@PathVariable("taskId") Long taskId);


    /**
     * 拉取任务
     *
     * @param type
     * @param priority
     * @return
     */
    @GetMapping("/api/v1/task/{taskId}/{priority}")
    public ResponseResult poll(@PathVariable("taskId") Integer type, @PathVariable("priority") Integer priority);

}